@extends('layouts.app')

@section('title')
    后台-搭配管理-审核
@stop

@section('extcss')
    <!--ext css-->
    <!-- Custom styling plus -->
    <style>
        .cartlabel {
            height: 30px;
            line-height: 3;
        }

        .item.bad .alert {
            left: 40%;
            color: black;
            margin-top: 10px;;
        }

        .ui-ribbon-container .ui-ribbon:after, .ui-ribbon-container .ui-ribbon:before {
            border-top: #d9534f;
        }

        .ui-ribbon-container .ui-ribbon {
            background-color: #d9534f;
        }
        .has-feedback .form-control{
            padding-right:0;
        }
        .form-control-feedback.left{
            color:#73879C;left:6px;
        }
    </style>
    <!-- Custom styling plus -->
    <!-- /ext css-->
@stop

@section('content')
    <!-- page content -->
    <div class="right_col" role="main">
        <div class="">
            <div class="page-title">
                <div class="title_left">
                    <h3>服装搭配审核</h3>
                </div>

                <div class="title_right">
                    &nbsp;
                </div>
            </div>

            <div class="clearfix"></div>

            <div class="row">
                <div class="col-md-9 col-xs-12 col-sm-12">
                    <div class="x_panel">
                        <div class="x_title">
                            <h2>服装搭配审核</h2>
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="x_content">

                            <div class="row" id="divItems">
                            @forelse($assorts->goodsitem as $goodsitem)
                                <!--item-->
                                    <div class="col-md-3 col-xs-12 widget widget_tally_box">
                                        <div class="x_panel ui-ribbon-container">
                                            @if($goodsitem->number<1)
                                                <div class="ui-ribbon-wrapper" style="z-index: 1" data="{{$goodsitem->goodsid}}">
                                                    @else
                                                        <div class="ui-ribbon-wrapper" style="z-index: 1;display: none" data="{{$goodsitem->goodsid}}">
                                                            @endif
                                                            <div class="ui-ribbon initialism">
                                                                <strong>
                                                                    <mark>off</mark>
                                                                </strong>
                                                            </div>
                                                        </div>
                                                        <div class="x_content">
                                                            <div style="text-align: center; margin-bottom: 17px">
                                                                <img class="img-thumbnail"
                                                                     src="{{asset("upload/images/".($goodsitem->img ==null ? "default.png":pathinfo($goodsitem->img)["basename"]))}}" style="width:225px;height: 255px;">
                                                            </div>
                                                            <div>
                                                                <ul class="list-inline widget_tally">
                                                                    <li>
                                                                        <div class="form-group">
                                                                            <label class="cartlabel control-label col-md-4 col-sm-3 col-xs-3">尺码</label>
                                                                            <div class="col-md-8 col-sm-9 col-xs-9">
                                                                                <span class="lead"><mark>{{$goodsitem->size}}</mark></span>
                                                                            </div>
                                                                        </div>
                                                                    </li>
                                                                    <li>
                                                                        <div class="form-group">
                                                                            <label class="cartlabel control-label col-md-4 col-sm-3 col-xs-3">颜色</label>
                                                                            <div class="col-md-8 col-sm-9 col-xs-9">
                                                                                <span class="lead"><mark>{{$goodsitem->color}}</mark></span>
                                                                            </div>
                                                                        </div>
                                                                    </li>
                                                                    <li>
                                                                        <div class="form-group">
                                                                            <label class="cartlabel control-label col-md-4 col-sm-3 col-xs-3">分类</label>
                                                                            <div class="col-md-8 col-sm-9 col-xs-9">
                                                                                <span class="lead"><mark>{{$goodsitem->category}}</mark></span>
                                                                            </div>
                                                                        </div>
                                                                    </li>
                                                                    <li>
                                                                        <div class="form-group">
                                                                            <label class="cartlabel control-label col-md-4 col-sm-3 col-xs-3">数量</label>
                                                                            <div class="col-md-8 col-sm-9 col-xs-9">
                                                                                <span class="lead"><mark>{{$goodsitem->number}}</mark></span>
                                                                            </div>
                                                                        </div>
                                                                    </li>
                                                                </ul>
                                                                <div class="clearfix"></div>
                                                            </div>
                                                        </div>
                                                </div>
                                        </div>
                                        <!-- /item-->
                                        @empty
                                            <h5>无物品记录</h5>
                                        @endforelse
                                    </div>
                            </div>
                        </div>

                        <div class="row">
                            @if($errors->any())
                                <div class="ln_solid"></div>
                                <ul class="list-group">
                                    @foreach($errors->all() as $error)
                                        <li class="list-group-item list-group-item-danger">{{$error}}</li>
                                    @endforeach
                                </ul>
                            @endif
                        </div>
                    </div>
                    <div class="col-md-3 col-xs-12 col-sm-12">
                        <form id="assortForm" method="post" action="{{url('system/assort/store')}}"
                              class="form-horizontal form-label-left">
                            {!!csrf_field()!!}
                            <div class="x_panel">
                                <div class="x_title">
                                    <h2>客服信息审核</h2>
                                    <ul class="nav navbar-right panel_toolbox">
                                        <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                        </li>
                                    </ul>
                                    <div class="clearfix"></div>
                                </div>
                                <div class="x_content">

                                    <input type="hidden" id="assortJson" name="assortJson" value="{{json_encode($assorts->goodsitem)}}"/>
                                    <div class="item form-group">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">客户姓名 <span
                                                    class="required">*</span>
                                        </label>
                                        <div class="col-md-9 col-sm-12 col-xs-12">
                                            <input type="text" id="name" name="name"
                                                   class="form-control col-md-7 col-xs-12" placeholder="测试先生"
                                                   value="{{$assorts->name}}" readonly>
                                        </div>
                                    </div>
                                    <div class="item form-group">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="wechat">客户微信 <span
                                                    class="required">*</span>
                                        </label>
                                        <div class="col-md-9 col-sm-12 col-xs-12">
                                            <input type="text" id="wechat" name="wechat"
                                                   class="form-control col-md-7 col-xs-12" placeholder="测试微信号"
                                                   value="{{$assorts->wechat}}" readonly>
                                        </div>
                                    </div>
                                    <div class="item form-group">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="mobile">客户电话 <span
                                                    class="required">*</span>
                                        </label>
                                        <div class="col-md-9 col-sm-12 col-xs-12">
                                            <input type="tel" id="mobile" name="mobile"
                                                   class="form-control col-md-7 col-xs-12" data-parsley-length="[8, 20]"
                                                   value="{{$assorts->mobile}}" readonly>
                                        </div>
                                    </div>
                                    <div class="item form-group">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="selProvince">客户地址
                                            <span class="required">*</span>
                                        </label>
                                        <div class="col-md-9 col-md-offset-3 col-sm-12 col-xs-12">
                                            <textarea id="address" name="address"
                                                      class="form-control col-md-7 col-xs-12"
                                                      readonly>{{$assorts->address}}</textarea>
                                        </div>
                                    </div>
                                    <div class="clearfix"></div>
                                </div>
                            </div>
                            <div class="x_panel">
                                <div class="x_title">
                                    <h2>增加物流信息</h2>
                                    <ul class="nav navbar-right panel_toolbox">
                                        <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                        </li>
                                    </ul>
                                    <div class="clearfix"></div>
                                </div>
                                <div class="x_content">
                                    <div class="item form-group">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">出库快递 <span
                                                    class="required">*</span>
                                        </label>
                                        <div class="col-md-9 col-sm-12 col-xs-12">
                                            <select id="express_out_company" name="express_out_company" class="select2_single form-control" tabindex="-1" required="">
                                                <option value="" selected>请选择快递公司</option>
                                                <option value="申通快递">申通快递</option>
                                                <option value="圆通快递">圆通快递</option>
                                                <option value="中通快递">中通快递</option>
                                                <option value="顺丰快递">顺丰快递</option>
                                                <option value="韵达快递">韵达快递</option>
                                                <option value="天天快递">天天快递</option>
                                                <option value="汇通快递">汇通快递</option>
                                                <option value="EMS快递">EMS快递</option>
                                                <option value="宅急送">宅急送</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="item form-group">
                                        <div class="col-md-9 col-md-offset-3 col-sm-12 col-xs-12">
                                            <div class="control-group">
                                                <div class="controls">
                                                    <div class="xdisplay_inputx form-group has-feedback">
                                                        <input type="text" id="express_out_no" name="express_out_no" class="form-control has-feedback-left active" placeholder="出库快递单号" required="">
                                                        <span class="fa fa-truck form-control-feedback left" aria-hidden="true"></span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="item form-group">
                                        <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">回库快递 <span
                                                    class="required">*</span>
                                        </label>
                                        <div class="col-md-9 col-sm-12 col-xs-12">
                                            <select id="express_in_company" name="express_in_company" class="select2_single form-control" tabindex="-1" required="">
                                                <option value="" selected>请选择快递公司</option>
                                                <option value="申通快递">申通快递</option>
                                                <option value="圆通快递">圆通快递</option>
                                                <option value="中通快递">中通快递</option>
                                                <option value="顺丰快递">顺丰快递</option>
                                                <option value="韵达快递">韵达快递</option>
                                                <option value="天天快递">天天快递</option>
                                                <option value="汇通快递">汇通快递</option>
                                                <option value="EMS快递">EMS快递</option>
                                                <option value="宅急送">宅急送</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="item form-group">
                                        <div class="col-md-9 col-md-offset-3 col-sm-12 col-xs-12">
                                            <div class="control-group">
                                                <div class="controls">
                                                    <div class="xdisplay_inputx form-group has-feedback">
                                                        <input type="text" id="express_in_no" name="express_in_no" class="form-control has-feedback-left active" placeholder="出库快递单号" required="">
                                                        <span class="fa fa-truck form-control-feedback left" aria-hidden="true"></span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="clearfix"></div>
                                </div>
                            </div>

                            <div class="x_panel">
                                <div class="x_title">
                                    <h2>确认提交</h2>

                                    <div class="clearfix"></div>
                                </div>
                                <div class="x_content">
                                    <div class="form-group">
                                        <div class="col-md-6 text-center">
                                            @if ($assorts->ispost)
                                                <button type="submit" class="btn btn-success">
                                                    提交
                                                </button>
                                            @else
                                                <button type="submit" class="btn btn-success" disabled>
                                                    提交
                                                </button>
                                            @endif
                                        </div>
                                        <div class="col-md-6 text-center">
                                            <button id="btnGoback" type="button" class="btn btn-default">重新选择</button>
                                        </div>
                                    </div>
                                    <div class="clearfix"></div>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /page content -->
@stop

@section('extjs')
<!--ext js-->
    <!--store.js-->
    <script src="//cdn.bootcss.com/store.js/1.3.20/store.min.js"></script>
    <!--json2.js-->
    <script src="//cdn.bootcss.com/json2/20150503/json2.min.js"></script>
    <!-- Switchery -->
    <script src="{{asset("vendors/switchery/dist/switchery.min.js")}}"></script>
    <!-- Parsley -->
    <script src="{{asset("vendors/parsleyjs/dist/parsley.min.js")}}"></script>
    <script src="{{asset("vendors/parsleyjs/dist/i18n/zh_cn.js")}}"></script>

    <!--Parsley-->
    <script type="text/javascript">
        $(function () {
            $('#assortForm').parsley().on('field:validated', function() {
                var ok = $('.parsley-error').length === 0;
                $('.bs-callout-info').toggleClass('hidden', !ok);
                $('.bs-callout-warning').toggleClass('hidden', ok);
            }).on('form:submit', function() {
                store.clear();
                $(this).submit();
            });
        });
    </script>
    <!-- /Parsley-->

    <!-- 重新选择 -->
    <script>
        $("#btnGoback").click(function () {

            $('.ui-ribbon-wrapper:not(:hidden)').each(function (index,item) {

                //查看store是否为空
                store.remove($(this).attr('data'));
            });
            window.history.go(-1);
        });
    </script>
    <!-- /重新选择 -->
<!-- /ext js-->
@stop